﻿using System.Configuration;

namespace LeanBoard
{
    public class ProfilesConfigSection : ConfigurationSection
    {
        [ConfigurationProperty("profiles", IsRequired = true)]
        public ProfilesElementCollection Profiles
        {
            get { return (ProfilesElementCollection)base["profiles"]; }
        }
    }

    public class ProfilesElementCollection : ConfigurationElementCollection
    {

        public ProfilesElement this[int index]
        {
            get { return base.BaseGet(index) as ProfilesElement; }
        }

        public ProfilesElement this[object key]
        {
            get
            {
                return base.BaseGet(key) as ProfilesElement;
            }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new ProfilesElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((ProfilesElement)element).DominoName;
        }
    }

    public class ProfilesElement : ConfigurationElement
    {
        [ConfigurationProperty("dominoName", IsRequired = true)]
        public string DominoName
        {
            get
            {
                return this["dominoName"] as string;
            }
        }

        [ConfigurationProperty("displayName", IsRequired = true)]
        public string DisplayName
        {
            get
            {
                return this["displayName"] as string;
            }
        }

        [ConfigurationProperty("imageName", IsRequired = true)]
        public string ImageName
        {
            get
            {
                return this["imageName"] as string;
            }
        }

        [ConfigurationProperty("country", IsRequired = false)]
        public string Country
        {
            get
            {
                return this["country"] as string;
            }
        }
    }
}